import { Image, StyleSheet, Text, TouchableOpacity, View } from "react-native";
import { ArticleType } from "../util/publicType";

interface PropType {
  item: ArticleType;
}

// 文章列表
const Index = ({ item }: PropType) => {
  return (
    <View style={styles.box}>
      <TouchableOpacity onPress={() => console.log("详情")}>

        <Image source={{
          uri: item.cover.path
        }} style={{ width: "100%", height: 80 }} resizeMode="cover"></Image>
        <Text style={styles.txt}>{item.name}</Text>
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  box: {
    width: "48%",
    minWidth: "48%",
    maxWidth: "48%",
    position: "relative",
    marginBottom: 10
  },
  txt: {
    textAlign: "center",
    width: "100%",
    backgroundColor: "rgba(0, 0, 0, 0.5)",
    position: "absolute",
    left: 0,
    bottom: 0,
    paddingTop: 2,
    paddingBottom: 2,
    fontSize: 14,
    color: "#fff"
  }
});

export default Index;
